package com.ai.bitcoin.jpa.dao;

import com.ai.bitcoin.jpa.entity.BccPriceEstimate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface BccPriceEstimateDao extends JpaRepository<BccPriceEstimate, String> {

    @Query(value = "SELECT * FROM coin_price_estimate_fg " +
            "WHERE bcc_id = :bccId " +
            "  AND latest = 1 " +
            "  AND market = 'blockcc' " +
            "  AND ds > SYSDATE() " +
            "ORDER BY ds ASC ", nativeQuery = true)
    List<BccPriceEstimate> findPriceEstimateByBccId(@Param("bccId") String bccId);
}
